<?php

namespace app\model;

use app\BaseModel;
use think\model\relation\BelongsTo;

/**
 * 教职工-测评任务量表表
 */
class WorkersTaskRatingScaleModel extends BaseModel
{
    protected $name = 'workers_task_rating_scale';

    /**
     * 关联量表
     * @return BelongsTo
     */
    public function ratingScale(): BelongsTo
    {
        return $this->belongsTo('RatingScaleModel','rating_scale_id')->bind([
            'rating_scale_name'=>'name',
            'rating_scale_cover'=>'cover'
        ]);
    }

    /**
     * 关联量表包
     * @return BelongsTo
     */
    public function ratingScalePack(): BelongsTo
    {
        return $this->belongsTo('RatingScalePackModel','pack_id')->bind(['rating_scale_pack_name'=>'name']);
    }

    /**
     * 关联任务
     * @return BelongsTo
     */
    public function task(): BelongsTo
    {
        return $this->belongsTo('WorkersTaskModel','task_id')->bind([
            'task_name'=>'name',
            'task_user_count'=>'user_count',
            'task_user_complete_num'=>'user_complete_num',
            'task_warning_num'=>'warning_num'
        ]);
    }

}